'''
Created on 2009-12-5

@author: Administrator
'''
#coding:utf-8
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.api import urlfetch 
import urllib,logging,sys
from google.appengine.api import users
import urllib2
if __name__ == '__main__':
    target_url = "http://api.javaeye.com/api/twitters/create"
    title = "test api"
    url = u"http://"
    
    zdata = {"body":"%s %s"%(title.encode('utf-8'),url.encode("utf-8")),
            "via":"Google reader"
            }
    zheaders = {'Authorization':'Basic amFtaWVzdW46NTk0MTIz',
               'User-Agent':'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'
             }
    data = urllib.urlencode(zdata) 
    req = urllib2.Request(target_url)  
    req.add_header('Authorization', 'Basic amFtaWVzdW46NTk0MTIz')
    req.add_header('User-Agent', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)')
    resp = urllib2.urlopen(req,data)
    

    print resp.read()

